


package jnpf.controller;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import jnpf.service.ZXGL_OrganizeService;
import jnpf.service.impl.ZXGL_OrganizeServiceImpl;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.base.util.DynDicUtil;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.entity.ZXGL_XiangMuFenJie_ZhuBiaoEntity;
import jnpf.entity.ZXGL_XiangMuFenJie_mingxibiaoEntity;
import jnpf.exception.DataException;
import jnpf.generater.util.GeneraterSwapUtil;
import jnpf.model.common.ZXGL_Leaders;
import jnpf.model.common.ZXGL_ZzbmLeaders;
import jnpf.model.zxgl_xiangmufenjie.*;
import jnpf.permission.OrganizeApi;
import jnpf.permission.entity.OrganizeEntity;
import jnpf.service.ZXGL_XiangMuFenJie_ZhuBiaoService;
import jnpf.service.ZXGL_XiangMuFenJie_mingxibiaoService;
import jnpf.util.JsonUtil;
import jnpf.util.RandomUtil;
import jnpf.util.UserProvider;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * ZXGL_XiangMuFenJie_ZhuBiao
 *
 * @版本： V2.0
 * @版权： 河北交投智能交通技术有限责任公司
 * @作者： 数字交投项目组
 * @日期： 2025-03-19
 */
@Slf4j
@RestController
@Api(tags = "ZXGL_XiangMuFenJie_ZhuBiao", value = "zxgl")
@RequestMapping("/ZXGL_XiangMuFenJie_ZhuBiao")
public class ZXGL_XiangMuFenJie_ZhuBiaoController {


    @Autowired
    private DynDicUtil dynDicUtil;

    @Autowired
    private GeneraterSwapUtil generaterSwapUtil;

    @Autowired
    private UserProvider userProvider;

    @Autowired
    private ZXGL_XiangMuFenJie_ZhuBiaoService zXGL_XiangMuFenJie_ZhuBiaoService;

    @Autowired
    private ZXGL_XiangMuFenJie_mingxibiaoService zXGL_XiangMuFenJie_mingxibiaoService;

    @Autowired
    private ZXGL_OrganizeService zxglOrganizeService;

    @Autowired
    private OrganizeApi organizeApi;

    /**
     * 列表
     *
     * @param zXGL_XiangMuFenJie_ZhuBiaoPagination
     * @return
     */
    @PostMapping("/getList")
    public ActionResult list(@RequestBody ZXGL_XiangMuFenJie_ZhuBiaoPagination zXGL_XiangMuFenJie_ZhuBiaoPagination) throws IOException {
        List<ZXGL_XiangMuFenJie_ZhuBiaoEntity> list = zXGL_XiangMuFenJie_ZhuBiaoService.getList(zXGL_XiangMuFenJie_ZhuBiaoPagination);
        //处理id字段转名称，若无需转或者为空可删除
        for (ZXGL_XiangMuFenJie_ZhuBiaoEntity entity : list) {
            entity.setXmlx(dynDicUtil.getDicName(entity.getXmlx(), "667277254828496197"));
            entity.setXmly(dynDicUtil.getDicName(entity.getXmly(), "667353988936504645"));
            entity.setZdxm(dynDicUtil.getDicName(entity.getZdxm(), "669876395320571525"));
            entity.setXmfkzq(dynDicUtil.getDicName(entity.getXmfkzq(), "667375897669539141"));
            entity.setScwj(generaterSwapUtil.getFileNameInJson(entity.getScwj()));
            entity.setZrr(generaterSwapUtil.userSelectValues(entity.getZrr()));
            entity.setZrbm(generaterSwapUtil.comSelectValues(entity.getZrbm()));
        }
        List<ZXGL_XiangMuFenJie_ZhuBiaoListVO> listVO = JsonUtil.getJsonToList(list, ZXGL_XiangMuFenJie_ZhuBiaoListVO.class);
        for (ZXGL_XiangMuFenJie_ZhuBiaoListVO zXGL_XiangMuFenJie_ZhuBiaoVO : listVO) {
        }


        PageListVO vo = new PageListVO();
        vo.setList(listVO);
        PaginationVO page = JsonUtil.getJsonToBean(zXGL_XiangMuFenJie_ZhuBiaoPagination, PaginationVO.class);
        vo.setPagination(page);
        return ActionResult.success(vo);
    }


    /**
     * 创建
     *
     * @param zXGL_XiangMuFenJie_ZhuBiaoCrForm
     * @return
     */
    @PostMapping
    @Transactional
    public ActionResult create(@RequestBody @Valid ZXGL_XiangMuFenJie_ZhuBiaoCrForm zXGL_XiangMuFenJie_ZhuBiaoCrForm) throws DataException {
        String mainId = RandomUtil.uuId();
        UserInfo userInfo = userProvider.get();
        ZXGL_XiangMuFenJie_ZhuBiaoEntity entity = JsonUtil.getJsonToBean(zXGL_XiangMuFenJie_ZhuBiaoCrForm, ZXGL_XiangMuFenJie_ZhuBiaoEntity.class);
        entity.setId(mainId);
        entity.setCreatorTime(new Date());

        // region 子表赋值主责部门负责人和部门领导
        ZXGL_ZzbmLeaders zzbmLeaders = zxglOrganizeService.getZzbmLeaders(entity.getZrbm());
        entity.setDepartmentManagerZzbm(zzbmLeaders.getDepartmentManagerZzbm());
        entity.setDepartmentHeadleaderZzbm(zzbmLeaders.getDepartmentHeadleaderZzbm());
        // endregion

        zXGL_XiangMuFenJie_ZhuBiaoService.save(entity);
        List<ZXGL_XiangMuFenJie_mingxibiaoEntity> ZXGL_XiangMuFenJie_mingxibiaoList = JsonUtil.getJsonToList(zXGL_XiangMuFenJie_ZhuBiaoCrForm.getZxgl_xiangmufenjie_mingxibiaoList(), ZXGL_XiangMuFenJie_mingxibiaoEntity.class);

        ZXGL_Leaders leaders = zxglOrganizeService.getLeaders();
        String prefix = entity.getXmbh() + "-";
        String strNum = zXGL_XiangMuFenJie_mingxibiaoService.findMaxSequence(entity.getXmid(), prefix);
        Long num;
        if (strNum == null) {
            num = 0l;
        } else {
            num = Long.parseLong(strNum);
        }
        num++;
        if (ZXGL_XiangMuFenJie_mingxibiaoList != null && ZXGL_XiangMuFenJie_mingxibiaoList.size() > 0) {
            for (ZXGL_XiangMuFenJie_mingxibiaoEntity entitys : ZXGL_XiangMuFenJie_mingxibiaoList) {
//                entitys.setId(RandomUtil.uuId());
//                entitys.setMainid(entity.getId());
//                entitys.setCreatorTime(new Date());
//                String sequence = entity.getXmbh() + "-" + String.format("%04d", num);
//                entitys.setRwbh(sequence);

                // region 子表赋值主责部门负责人和部门领导
//                entitys.setDepartmentManagerZzbm(zzbmLeaders.getDepartmentManagerZzbm());
//                entitys.setDepartmentHeadleaderZzbm(zzbmLeaders.getDepartmentHeadleaderZzbm());
                // endregion

//                zXGL_XiangMuFenJie_mingxibiaoService.save(entitys);

                // region 子表赋值主责部门负责人和部门领导
                entitys.setDepartmentManagerZzbm(zzbmLeaders.getDepartmentManagerZzbm());
                entitys.setDepartmentHeadleaderZzbm(zzbmLeaders.getDepartmentHeadleaderZzbm());
                // endregion
                log.info("entitys:==============================>" + entitys);
                if(StrUtil.isNotEmpty(entitys.getId())){
                    zXGL_XiangMuFenJie_mingxibiaoService.updateById(entitys);
                }else{
                    entitys.setId(RandomUtil.uuId());
                    entitys.setMainid(entity.getId());
                    String sequence = entity.getXmbh() + "-" + String.format("%04d", num);
                    entitys.setRwbh(sequence);
                    zXGL_XiangMuFenJie_mingxibiaoService.save(entitys);
                    num++;
                }
            }
        }
        return ActionResult.success("保存成功", mainId);
    }


    /**
     * 信息
     *
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public ActionResult<ZXGL_XiangMuFenJie_ZhuBiaoInfoVO> info(@PathVariable("id") String id) {
        ZXGL_XiangMuFenJie_ZhuBiaoEntity entity = zXGL_XiangMuFenJie_ZhuBiaoService.getInfo(id);
        ZXGL_XiangMuFenJie_ZhuBiaoInfoVO vo = JsonUtil.getJsonToBean(entity, ZXGL_XiangMuFenJie_ZhuBiaoInfoVO.class);

        //子表
        List<ZXGL_XiangMuFenJie_mingxibiaoEntity> ZXGL_XiangMuFenJie_mingxibiaoList = zXGL_XiangMuFenJie_ZhuBiaoService.GetZXGL_XiangMuFenJie_mingxibiaoList(id);
        for (ZXGL_XiangMuFenJie_mingxibiaoEntity zxgl_xiangmufenjie_mingxibiaoEntity : ZXGL_XiangMuFenJie_mingxibiaoList) {

        }
        if (ZXGL_XiangMuFenJie_mingxibiaoList != null && ZXGL_XiangMuFenJie_mingxibiaoList.size() > 0) {
            vo.setZXGL_XiangMuFenJie_mingxibiaoList(JsonUtil.getJsonToList(ZXGL_XiangMuFenJie_mingxibiaoList, ZXGL_XiangMuFenJie_mingxibiaoModel.class));
        }
        //副表
        return ActionResult.success(vo);
    }

    /**
     * 表单信息(详情页)
     *
     * @param id
     * @return
     */
    @GetMapping("/detail/{id}")
    public ActionResult<ZXGL_XiangMuFenJie_ZhuBiaoInfoVO> detailInfo(@PathVariable("id") String id) {
        ZXGL_XiangMuFenJie_ZhuBiaoEntity entity = zXGL_XiangMuFenJie_ZhuBiaoService.getInfo(id);
        ZXGL_XiangMuFenJie_ZhuBiaoInfoVO vo = JsonUtil.getJsonToBean(entity, ZXGL_XiangMuFenJie_ZhuBiaoInfoVO.class);
        vo.setXmlx(dynDicUtil.getDicName(vo.getXmlx(), "667277254828496197"));
        vo.setXmly(dynDicUtil.getDicName(vo.getXmly(), "667353988936504645"));
        vo.setZdxm(dynDicUtil.getDicName(vo.getZdxm(), "669876395320571525"));
        vo.setXmfkzq(dynDicUtil.getDicName(vo.getXmfkzq(), "667375897669539141"));
        vo.setScwj(generaterSwapUtil.getFileNameInJson(vo.getScwj()));
        vo.setZrr(generaterSwapUtil.userSelectValues(vo.getZrr()));
        vo.setZrbm(generaterSwapUtil.comSelectValues(vo.getZrbm()));

        //子表数据转换
        List<ZXGL_XiangMuFenJie_mingxibiaoEntity> zXGL_XiangMuFenJie_mingxibiaoList = zXGL_XiangMuFenJie_ZhuBiaoService.GetZXGL_XiangMuFenJie_mingxibiaoList(id);
        for (ZXGL_XiangMuFenJie_mingxibiaoEntity zXGL_XiangMuFenJie_mingxibiaoEntity : zXGL_XiangMuFenJie_mingxibiaoList) {
            zXGL_XiangMuFenJie_mingxibiaoEntity.setRwly(dynDicUtil.getDicName(zXGL_XiangMuFenJie_mingxibiaoEntity.getRwly(), "667353988936504645"));
            zXGL_XiangMuFenJie_mingxibiaoEntity.setRwlx(dynDicUtil.getDicName(zXGL_XiangMuFenJie_mingxibiaoEntity.getRwlx(), "667277254828496197"));
            zXGL_XiangMuFenJie_mingxibiaoEntity.setZrbm(generaterSwapUtil.comSelectValues(zXGL_XiangMuFenJie_mingxibiaoEntity.getZrbm()));
            zXGL_XiangMuFenJie_mingxibiaoEntity.setZrr(generaterSwapUtil.userSelectValues(zXGL_XiangMuFenJie_mingxibiaoEntity.getZrr()));
            zXGL_XiangMuFenJie_mingxibiaoEntity.setXzbm(generaterSwapUtil.comSelectValues(zXGL_XiangMuFenJie_mingxibiaoEntity.getXzbm()));
            zXGL_XiangMuFenJie_mingxibiaoEntity.setXzr(generaterSwapUtil.userSelectValues(zXGL_XiangMuFenJie_mingxibiaoEntity.getXzr()));
            zXGL_XiangMuFenJie_mingxibiaoEntity.setSjlx(dynDicUtil.getDicName(zXGL_XiangMuFenJie_mingxibiaoEntity.getSjlx(), "670160918163781253"));
            zXGL_XiangMuFenJie_mingxibiaoEntity.setSjdw(dynDicUtil.getDicName(zXGL_XiangMuFenJie_mingxibiaoEntity.getSjdw(), "671337925434177157"));
            zXGL_XiangMuFenJie_mingxibiaoEntity.setFkzq(dynDicUtil.getDicName(zXGL_XiangMuFenJie_mingxibiaoEntity.getFkzq(), "667375897669539141"));
            zXGL_XiangMuFenJie_mingxibiaoEntity.setZqrw(dynDicUtil.getDicName(zXGL_XiangMuFenJie_mingxibiaoEntity.getZqrw(), "669876395320571525"));
            zXGL_XiangMuFenJie_mingxibiaoEntity.setGxckry(generaterSwapUtil.userSelectValues(zXGL_XiangMuFenJie_mingxibiaoEntity.getGxckry()));
            zXGL_XiangMuFenJie_mingxibiaoEntity.setZt(dynDicUtil.getDicName(zXGL_XiangMuFenJie_mingxibiaoEntity.getZt(), "667276146122954053"));
            zXGL_XiangMuFenJie_mingxibiaoEntity.setBgqzt(dynDicUtil.getDicName(zXGL_XiangMuFenJie_mingxibiaoEntity.getBgqzt(), "667276146122954053"));
            zXGL_XiangMuFenJie_mingxibiaoEntity.setYjbj(dynDicUtil.getDicName(zXGL_XiangMuFenJie_mingxibiaoEntity.getYjbj(), "667375644950140229"));
            zXGL_XiangMuFenJie_mingxibiaoEntity.setWcjfw(generaterSwapUtil.getFileNameInJson(zXGL_XiangMuFenJie_mingxibiaoEntity.getWcjfw()));
        }
        vo.setZXGL_XiangMuFenJie_mingxibiaoList(JsonUtil.getJsonToList(zXGL_XiangMuFenJie_mingxibiaoList, ZXGL_XiangMuFenJie_mingxibiaoModel.class));


        //附表数据转换
        return ActionResult.success(vo);
    }


    /**
     * 更新
     *
     * @param id
     * @return
     */
    @PutMapping("/{id}")
    @Transactional
    public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid ZXGL_XiangMuFenJie_ZhuBiaoUpForm zXGL_XiangMuFenJie_ZhuBiaoUpForm) throws DataException {
        UserInfo userInfo = userProvider.get();
        ZXGL_XiangMuFenJie_ZhuBiaoEntity entity = zXGL_XiangMuFenJie_ZhuBiaoService.getInfo(id);
        if (entity != null) {
            ZXGL_XiangMuFenJie_ZhuBiaoEntity subentity = JsonUtil.getJsonToBean(zXGL_XiangMuFenJie_ZhuBiaoUpForm, ZXGL_XiangMuFenJie_ZhuBiaoEntity.class);

            // region 子表赋值主责部门负责人和部门领导
            ZXGL_ZzbmLeaders zzbmLeaders = zxglOrganizeService.getZzbmLeaders(entity.getZrbm());
            entity.setDepartmentManagerZzbm(zzbmLeaders.getDepartmentManagerZzbm());
            entity.setDepartmentHeadleaderZzbm(zzbmLeaders.getDepartmentHeadleaderZzbm());
            // endregion

            zXGL_XiangMuFenJie_ZhuBiaoService.update(id, subentity);

//            QueryWrapper<ZXGL_XiangMuFenJie_mingxibiaoEntity> ZXGL_XiangMuFenJie_mingxibiaoqueryWrapper = new QueryWrapper<>();
//            ZXGL_XiangMuFenJie_mingxibiaoqueryWrapper.lambda().eq(ZXGL_XiangMuFenJie_mingxibiaoEntity::getMainid, entity.getId());
//            zXGL_XiangMuFenJie_mingxibiaoService.remove(ZXGL_XiangMuFenJie_mingxibiaoqueryWrapper);

            String prefix = entity.getXmbh() + "-";
            String strNum = zXGL_XiangMuFenJie_mingxibiaoService.findMaxSequence(entity.getXmid(), prefix);
            Long num;
            if (strNum == null) {
                num = 0l;
            } else {
                num = Long.parseLong(strNum);
            }
            num++;
            log.info("zXGL_XiangMuFenJie_ZhuBiaoUpForm.getZxgl_xiangmufenjie_mingxibiaoList():=========>" + zXGL_XiangMuFenJie_ZhuBiaoUpForm.getZxgl_xiangmufenjie_mingxibiaoList());
            if (zXGL_XiangMuFenJie_ZhuBiaoUpForm.getZxgl_xiangmufenjie_mingxibiaoList() != null && zXGL_XiangMuFenJie_ZhuBiaoUpForm.getZxgl_xiangmufenjie_mingxibiaoList().size() > 0) {
                List<ZXGL_XiangMuFenJie_mingxibiaoEntity> ZXGL_XiangMuFenJie_mingxibiaoList = JsonUtil.getJsonToList(zXGL_XiangMuFenJie_ZhuBiaoUpForm.getZxgl_xiangmufenjie_mingxibiaoList(), ZXGL_XiangMuFenJie_mingxibiaoEntity.class);
                for (ZXGL_XiangMuFenJie_mingxibiaoEntity entitys : ZXGL_XiangMuFenJie_mingxibiaoList) {

                    // region 子表赋值主责部门负责人和部门领导
                    entitys.setDepartmentManagerZzbm(zzbmLeaders.getDepartmentManagerZzbm());
                    entitys.setDepartmentHeadleaderZzbm(zzbmLeaders.getDepartmentHeadleaderZzbm());
                    // endregion
                    log.info("entitys:==============================>" + entitys);
                    if(StrUtil.isNotEmpty(entitys.getId())){
                        zXGL_XiangMuFenJie_mingxibiaoService.updateById(entitys);
                    }else{
                        entitys.setId(RandomUtil.uuId());
                        entitys.setMainid(entity.getId());
                        String sequence = entity.getXmbh() + "-" + String.format("%04d", num);
                        entitys.setRwbh(sequence);
                        zXGL_XiangMuFenJie_mingxibiaoService.save(entitys);
                        num++;
                    }
                }
            }

            return ActionResult.success("更新成功");
        } else {
            return ActionResult.fail("更新失败，数据不存在");
        }
    }


    /**
     * 删除
     *
     * @param id
     * @return
     */
    @DeleteMapping("/{id}")
    @Transactional
    public ActionResult delete(@PathVariable("id") String id) {
        ZXGL_XiangMuFenJie_ZhuBiaoEntity entity = zXGL_XiangMuFenJie_ZhuBiaoService.getInfo(id);
        if (entity != null) {
            zXGL_XiangMuFenJie_ZhuBiaoService.delete(entity);
            QueryWrapper<ZXGL_XiangMuFenJie_mingxibiaoEntity> queryWrapperZXGL_XiangMuFenJie_mingxibiao = new QueryWrapper<>();
            queryWrapperZXGL_XiangMuFenJie_mingxibiao.lambda().eq(ZXGL_XiangMuFenJie_mingxibiaoEntity::getMainid, entity.getId());
            zXGL_XiangMuFenJie_mingxibiaoService.remove(queryWrapperZXGL_XiangMuFenJie_mingxibiao);

        }
        return ActionResult.success("删除成功");
    }

    @PostMapping("/allocateProjectTaskCallBack")
    @Transactional
    public ActionResult allocateProjectTaskCallBack(@RequestBody ZXGL_AI_TaskCallBack zXGL_AI_TaskCallBack) {
        log.info("allocateProjectTaskCallBack----------------------------》回调已经成功");
        if (zXGL_AI_TaskCallBack.getSuccess()) {
            ZXGL_XiangMuFenJie_ZhuBiaoEntity entity = zXGL_XiangMuFenJie_ZhuBiaoService.getById(zXGL_AI_TaskCallBack.getFlowId());
            List<ZXGL_XiangMuFenJie_mingxibiaoEntity> list = new ArrayList<>();
            for (ZXGL_AI_TaskReturnJson item : zXGL_AI_TaskCallBack.getReturnJson()) {
                ZXGL_XiangMuFenJie_mingxibiaoEntity model = new ZXGL_XiangMuFenJie_mingxibiaoEntity();
                model.setXmid(entity.getXmid());
                model.setMainid(zXGL_AI_TaskCallBack.getFlowId());
                model.setRwmc(item.getTaskName());
                model.setZrr(item.getTaskResponsibleId());
                model.setZrbm(item.getResponsibleDepartment());
                model.setRwqz(new BigDecimal(item.getTaskWeight()));
                // model.setSjksrq(item.getTaskStartTime());
                // model.setSjwcrq(item.getTaskEndTime());
                list.add(model);
            }
            zXGL_XiangMuFenJie_mingxibiaoService.saveBatch(list);
        }

        return ActionResult.success("回调成功！");
    }

    /**
     * 根据项目id获取表单信息(详情页)
     *
     * @param xmid
     * @return
     */
    @GetMapping("/detailByXmid/{xmid}")
    public ActionResult<ZXGL_XiangMuFenJie_ZhuBiaoInfoVO> detailByXmid(@PathVariable("xmid") String xmid) {
        ZXGL_XiangMuFenJie_ZhuBiaoEntity entity = zXGL_XiangMuFenJie_ZhuBiaoService.getByXmid(xmid);
        if (entity != null) {
            ZXGL_XiangMuFenJie_ZhuBiaoInfoVO vo = JsonUtil.getJsonToBean(entity, ZXGL_XiangMuFenJie_ZhuBiaoInfoVO.class);
            vo.setXmlx(dynDicUtil.getDicName(vo.getXmlx(), "667277254828496197"));
            vo.setXmly(dynDicUtil.getDicName(vo.getXmly(), "667353988936504645"));
            vo.setZdxm(dynDicUtil.getDicName(vo.getZdxm(), "669876395320571525"));
            vo.setXmfkzq(dynDicUtil.getDicName(vo.getXmfkzq(), "667375897669539141"));
            vo.setScwj(generaterSwapUtil.getFileNameInJson(vo.getScwj()));
            vo.setZrr(generaterSwapUtil.userSelectValues(vo.getZrr()));
            vo.setZrbm(generaterSwapUtil.comSelectValues(vo.getZrbm()));

            //子表数据转换
            List<ZXGL_XiangMuFenJie_mingxibiaoEntity> zXGL_XiangMuFenJie_mingxibiaoList = zXGL_XiangMuFenJie_ZhuBiaoService.GetZXGL_XiangMuFenJie_mingxibiaoList(vo.getId());
            for (ZXGL_XiangMuFenJie_mingxibiaoEntity zXGL_XiangMuFenJie_mingxibiaoEntity : zXGL_XiangMuFenJie_mingxibiaoList) {
                zXGL_XiangMuFenJie_mingxibiaoEntity.setRwly(dynDicUtil.getDicName(zXGL_XiangMuFenJie_mingxibiaoEntity.getRwly(), "667353988936504645"));
                zXGL_XiangMuFenJie_mingxibiaoEntity.setRwlx(dynDicUtil.getDicName(zXGL_XiangMuFenJie_mingxibiaoEntity.getRwlx(), "667277254828496197"));
                zXGL_XiangMuFenJie_mingxibiaoEntity.setZrbm(generaterSwapUtil.comSelectValues(zXGL_XiangMuFenJie_mingxibiaoEntity.getZrbm()));
                zXGL_XiangMuFenJie_mingxibiaoEntity.setZrr(generaterSwapUtil.userSelectValues(zXGL_XiangMuFenJie_mingxibiaoEntity.getZrr()));
                zXGL_XiangMuFenJie_mingxibiaoEntity.setXzbm(generaterSwapUtil.comSelectValues(zXGL_XiangMuFenJie_mingxibiaoEntity.getXzbm()));
                zXGL_XiangMuFenJie_mingxibiaoEntity.setXzr(generaterSwapUtil.userSelectValues(zXGL_XiangMuFenJie_mingxibiaoEntity.getXzr()));
                zXGL_XiangMuFenJie_mingxibiaoEntity.setSjlx(dynDicUtil.getDicName(zXGL_XiangMuFenJie_mingxibiaoEntity.getSjlx(), "670160918163781253"));
                zXGL_XiangMuFenJie_mingxibiaoEntity.setSjdw(dynDicUtil.getDicName(zXGL_XiangMuFenJie_mingxibiaoEntity.getSjdw(), "671337925434177157"));
                zXGL_XiangMuFenJie_mingxibiaoEntity.setFkzq(dynDicUtil.getDicName(zXGL_XiangMuFenJie_mingxibiaoEntity.getFkzq(), "667375897669539141"));
                zXGL_XiangMuFenJie_mingxibiaoEntity.setZqrw(dynDicUtil.getDicName(zXGL_XiangMuFenJie_mingxibiaoEntity.getZqrw(), "669876395320571525"));
                zXGL_XiangMuFenJie_mingxibiaoEntity.setGxckry(generaterSwapUtil.userSelectValues(zXGL_XiangMuFenJie_mingxibiaoEntity.getGxckry()));
                zXGL_XiangMuFenJie_mingxibiaoEntity.setZt(dynDicUtil.getDicName(zXGL_XiangMuFenJie_mingxibiaoEntity.getZt(), "667276146122954053"));
                zXGL_XiangMuFenJie_mingxibiaoEntity.setBgqzt(dynDicUtil.getDicName(zXGL_XiangMuFenJie_mingxibiaoEntity.getBgqzt(), "667276146122954053"));
                zXGL_XiangMuFenJie_mingxibiaoEntity.setYjbj(dynDicUtil.getDicName(zXGL_XiangMuFenJie_mingxibiaoEntity.getYjbj(), "667375644950140229"));
                zXGL_XiangMuFenJie_mingxibiaoEntity.setWcjfw(generaterSwapUtil.getFileNameInJson(zXGL_XiangMuFenJie_mingxibiaoEntity.getWcjfw()));
            }
            vo.setZXGL_XiangMuFenJie_mingxibiaoList(JsonUtil.getJsonToList(zXGL_XiangMuFenJie_mingxibiaoList, ZXGL_XiangMuFenJie_mingxibiaoModel.class));


            //附表数据转换
            return ActionResult.success(vo);
        } else {
            return ActionResult.success("数据不存在！");

        }
    }

    @GetMapping("fzr/{deptId}")
    public ActionResult fzr(@PathVariable("deptId") String deptId) {
        //转办部门负责人
        OrganizeEntity zbfzr = organizeApi.getById(deptId);
        return ActionResult.success("查询成功", zbfzr.getManager());
    }

}
